<template>
  <div class="container-fluid">
    <headers :userInfo="true"></headers>
    <div class="details-box row">
      <div class="col-xs-12">
        <h3>我的详情：</h3>
        <div class="row">
          <div class="col-xs-4">我的ID：{{ objUser.id }}</div>
          <div class="col-xs-4">我的帐号：{{ myAccounts.username }}</div>
          <div class="col-xs-4">我的名称：{{ objUser.name }}</div>
        </div>
        <div class="row">
          <div class="col-xs-4">当前钻石库存：{{ objUser.nowStockBrick }}</div>
          <div class="col-xs-4">本月钻石销量：{{ objUser.thisMonthSellBrick }}</div>
          <div class="col-xs-4">总销量：{{ objUser.brickSellTotal }}</div>
        </div>
        <div class="row">
          <div class="col-xs-4">当前金币库存：{{ objUser.nowStockGold }}</div>
          <div class="col-xs-4">本月金币销量：{{ objUser.thisMonthSellGold }}</div>
          <div class="col-xs-4">总销量：{{ objUser.goldSellTotal }}</div>
        </div>
        <div class="row">
          <div class="col-xs-12">
            开设时间：{{ objUser.openTime | filterTime }}
          </div>
        </div>
        <div class="row">
          <div class="col-xs-12">
            备注：{{ objUser.desc }}
          </div>
        </div>
      </div>
    </div>
    <div class="row" style="margin-top: 0.6rem;">
      <div class="col-xs-4"><button class="btn" @click="editPersonal()" >编辑个人</button></div>
      <div class="col-xs-4"><button class="btn" @click="alterPassWrod()">修改密码</button></div>
      <div class="col-xs-4"><button class="btn">找回密码</button></div>
    </div>


  </div>
</template>
<script>
  import Headers from '../../components/Header.vue';
  import {mapActions,mapGetters} from 'vuex';
  import {userContent} from '../../service/getData';
  import {formatDate} from '../../commonJs/formatDate';
  export default {
    data(){
      return {
        headerTitle:'个人信息',
        returnStatus:true,
        objUser:'',
        myAccounts:''
      }
    },
    components:{Headers},
    computed:{
      ...mapGetters([
        'headerStatus'
      ])
    },
    mounted(){
      let _this = this;
      this.$nextTick(function () {
        _this.headers();
        _this.objUser = userContent.userInfo;
        _this.myAccounts = userContent.userLogin;
      })
    },
    methods:{
      headers(){
        this.headerStatus.headerTitle = this.headerTitle;
        this.headerStatus.returnStatus = this.returnStatus;
      },
      editPersonal(){

      },
      alterPassWrod(){

      }

    },
    filters:{
      filterTime(time){
        let date = new Date(time*1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
        return formatDate(date, 'yyyy-MM-dd hh:mm');
      }
    }

  }
</script>
<style scoped lang="less">
  @import "../../style/main";
</style>
